package com.ruoyi.webs.utils;


import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.LinkedHashMap;

public class AjaxJson
{
    private boolean success = true;
    private String errorCode = "-1";
    private String msg = "操作成功";
    private LinkedHashMap<String, Object> body = new LinkedHashMap<>();

    public LinkedHashMap<String, Object> getBody() {
        return this.body;
    }

    public void setBody(LinkedHashMap<String, Object> body) {
        this.body = body;
    }

    public void put(String key, Object value) {
        this.body.put(key, value);
    }

    public void remove(String key) {
        this.body.remove(key);
    }


    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public boolean isSuccess() {
        return this.success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }


    @JsonIgnore
    public String getJsonStr() {
        String json = JsonMapper.getInstance().toJson(this);
        return json;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorCode() {
        return this.errorCode;
    }
}